<script>
	
	export default {
		onLaunch: function() {
		},
		
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			checkLogin(showPrompt = true, toIndex = false){
				if (!uni.getStorageSync('token')) {
					if (showPrompt) {
						this.loginConfirm(toIndex)
					}
					return false
				} else {
					return true
				}
			},
			loginConfirm(toIndex = false){
				uni.showModal({
					content:"您还未登录，请先登录",
					title: "提示",
					confirmText: "去登录",
					success(res) {
						if (res.confirm) {
							uni.navigateTo({
								url: "/pages/login/login"
							})
						} else {
							if (toIndex) {
								uni.switchTab({
									url: "/pages/index/index"
								})
							}
							
						}
					}
				})
			},
			mergePage(result, page, list) {
				var $data = result.data;
				// console.log(page)
				// if (result.last_page == page) {
				// 	page = -1;
				// } else {
				// 	page++;
				// }
				// console.log(page)
				page++;
				for (var i in $data) {
					list.push($data[i]);
				}
				var param = {
					page: page,
					total: page,
					list: list
				}
				return param;
			},
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-ui/index.scss";
	@import "@/uni_modules/uview-ui/libs/css/flex.scss";
	@import "@/comm/common.scss";

	page {
		color: #333333;
	}
	.appBottom{
		width: 100%;
		padding: 30rpx;
		background-color: #fff;
		bottom: 0;
		left: 0;
		position: fixed;
	}
	.appInp{
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 40rpx 0;
		font-size: 28rpx;
		border-bottom: 1px solid #F7F7F9;
	}
	.appBtn {
		width: 100%;
		height: 88rpx;
		background: linear-gradient( 130deg, #F69792 0%, #EA4D44 100%);
		border-radius: 88rpx;
		text-align: center;
		line-height: 88rpx;
		color: #fff;
		font-size: 28rpx;
	}
	
</style>